package com.kevin.composite;

/**
 * 组合模式测试类
 *
 * @author kevin
 * @date 2025/8/22
 */
public class CompositeTest {

    public static void main(String[] args) {
        Component composite1 = new Composite();
        Component top = new Composite();

        Component leaf1 = new Leaf("A");
        Component leaf2 = new Leaf("B");
        Component leaf3 = new Leaf("C");

        composite1.add(leaf1);
        composite1.add(leaf2);

        top.add(composite1);
        top.add(leaf3);
        top.operation();
    }
}
